		var current="";//点击招聘负责人（自身）
		//Excl导出
	    //table传入table需要导出的数据表格ID,dlink传入a标签的id,name传入导出后文件的名称
	  	function daochuExcal(table,dlink,name){ 
	  		var uri = 'data:application/vnd.ms-excel;base64,';
	  		var template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><div>{table}</div></body></html>';
	  		var base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s)));};
	  		var format = function(s, c) 
	  		{
	  			return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; });
	  		};
	  		if (!table.nodeType) table = document.getElementById(table);
	    	var ctx = {worksheet: name || name, table:table.nextSibling.innerHTML};
	    	document.getElementById(dlink).href = uri + base64(format(template, ctx));
	        document.getElementById(dlink).download = name;//这里是关键所在,当点击之后,设置a标签的属性,这样就可以更改标签的标题了
	        document.getElementById(dlink).click();
	        ExcalStats = false;
	  };
 //候选人状态
    	function candidatestatus(status){
          	var candidatestatus= "";
         	if(status == 0){
         		candidatestatus="招聘中";
         	}else if(status == 1){
         		candidatestatus="待入职";
         	}else if(status == 2){
         		candidatestatus="已入职";
     		}else if(status == 3){
     			candidatestatus="已归档";
     		}else if(status == 4){
     			candidatestatus="已离职";
     		}
    		return candidatestatus;
        }
	    //内推任务状态
    	function recommendstatus(status){
          	var recommendedstatus= "";
         	if(status == 0){
         		recommendedstatus="未处理";
         	}else if(status == 1){
         		recommendedstatus="处理中";
         	}else if(status == 2){
         		recommendedstatus="已结束";
     		}
    		return recommendedstatus;
        }
    	 //招聘状态
    	function rostatus(status){
          	var roStatus= "";
         	if(status == 1){
         		roStatus="招聘中";
         	}else if(status == 2){
         		roStatus="待入职";
         	}else if(status == 3){
         		roStatus="成功入职";
     		}else if(status == 4){
     			roStatus="取消招聘";
     		}else if(status == 5){
         		roStatus="候选人放弃";
         	}else if(status == 6){
         		roStatus="更改招聘负责人";
     		}else if(status == 7){
         		roStatus="已关联";
     		}
    		return roStatus;
        }
        //人才状态
        function talent(status){
       		var talentstatus= "";
         	if(status == 1){
         		talentstatus="维护阶段";
         	}else if(status == 2){
         		talentstatus="待入职阶段";
         	}else if(status == 3){
         		talentstatus="已入职";
     		}else if(status == 4){
     			talentstatus="已离职";
     		}
    		return talentstatus;
        
        }   
        
        //职位类别
        function Positioncatagory(status){
        	var catagory = "";
        	if(status == 1){
        		catagory="文员/助理/叉车司机/仓管员/保安/厨工类 专员/技术员（IT类）";
         	}else if(status == 2){
         		catagory="专员/技术员（工作地点在创展的IT类或者非IT类）";
         	}else if(status == 3){
         		catagory="工程师/主管类";
     		}else if(status == 4){
     			catagory="工程师/主管类（工作地点在创展）";
     		}else if(status == 5){
     			catagory="培训师/设计师/销售类";
     		}else if(status == 6){
     			catagory="产品研发类设计师/工程师";
     		}else if(status == 7){
     			catagory="高级工程师/副经理及以上";
     		}else if(status == 8){
     			catagory="总监及以上";
     		}else if(status == 9){
     			catagory="一线员工";
     		}else if(status == 10){
     			catagory="专员/技术员（IT类）";
     		}
        
    		return catagory;
        }
        
        
       	 //判断是否
         function orresult(status){
         	var orresult= "";
         	if(status == 0){
         		orresult="否";
         	}else if(status == 1){
         		orresult="是";
         	}
    		return orresult;
         }
         
         //性别判断
         function sexstatus(status){
         	var sexstatus= "";
         	if(status == 1){
         		sexstatus="男";
         	}else if(status == 2){
         		sexstatus="女";
         	}else if(status == 3){
         		sexstatus="未知";
         	}
    		return sexstatus;
         }
         
         //判断学历
         function educationstatus(status){
         	var educationstatus= "";
         	if(status == 01){
         		educationstatus="博士研究生（博士后）";
         	}else if(status == 02){
         		educationstatus="博士研究生";
         	}else if(status == 03){
         		educationstatus="硕士研究生";
         	}else if(status == 04){
         		educationstatus="大学本科";
         	}else if(status == 05){
         		educationstatus="大专学历";
         	}else if(status == 06){
         		educationstatus="中专学历";
         	}else if(status == 07){
         		educationstatus="高中学历（职高）";
         	}else if(status == 08){
         		educationstatus="高中学历（技校）";
         	}else if(status == 09){
         		educationstatus="高中学历";
         	}else if(status == 10){
         		educationstatus="初中学历";
         	}else if(status == 11){
         		educationstatus="小学学历";
         	}else if(status == 12){
         		educationstatus="文盲或半文盲";
         	}else if(status == 13){
         		educationstatus="无学历证书";
         	}
         	
    		return educationstatus;
         }
         //判断英语水平
         function english_levels(status){
         	var english_levels= "";
         	if(status == 01){
         		english_levels="大学英语四级";
         	}else if(status == 02){
         		english_levels="大学英语六级";
         	}else if(status == 03){
         		english_levels="专业四级";
         	}else if(status == 04){
         		english_levels="专业八级";
         	}else if(status == 05){
         		english_levels="无";
         	}
         	
    		return english_levels;
         }
         //体检状态
     	function healthReportStatus(status){
           	var roStatus= "";
          	if(status == 1){
          		roStatus="已发送";
          	}else if(status == 2){
          		roStatus="合格";
          	}else if(status == 3){
          		roStatus="不合格";
      		}else if(status == 4){
      			roStatus="需复检";
      		}
     		return roStatus;
         }
         
         //环节判断
         function Abandonmentstatus(status){
         	var abandonmentstatus= "";
         	if(status == 1){
         		abandonmentstatus="初筛";
         	}else if(status == 2){
         		abandonmentstatus="电话面试";
         	}else if(status == 3){
         		abandonmentstatus="人力面试";
         	}else if(status == 4){
         		abandonmentstatus="部门面试";
         	}else if(status == 5){
         		abandonmentstatus="待入职环节";
         	}else if(status == 6){
         		abandonmentstatus="已入职";
         	}
    		return abandonmentstatus;
         }
       //返回年龄
         function getAge(birthdate){
         	var returnAge; 
       		if(birthdate!=null && birthdate!="" ){
 		   
 		    var strBirthdayArr=birthdate.split("-");  
 		    var birthYear = strBirthdayArr[0];  
 		
 		    var d = new Date();  
 		    var nowYear = d.getFullYear();  
 		
 		    if(nowYear == birthYear)  
 		    {  
 		        returnAge = 0;//同年 则为0岁  
 		    }  
 		    else  
 		    {  
 		        var ageDiff = nowYear - birthYear ; //年之差  
 		        if(ageDiff > 0)  
 		        {  
 		        	returnAge =ageDiff;
 		        }  
 		        else  
 		        {  
 		            returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天  
 		        }  
 		    }  
 		  }else{
 		  		returnAge="0";
 		  }
 		    return returnAge+" 岁";//返回周岁年龄  
 		         
          
          }
         
     	//DateTime 转换为 Date
		Date.prototype.format = function(fmt){
	    var o = { 
	        "M+" : this.getMonth()+1,                 //月份 
	        "d+" : this.getDate(),                    //日 
	        "h+" : this.getHours(),                   //小时 
	        "m+" : this.getMinutes(),                 //分 
	        "s+" : this.getSeconds(),                 //秒 
	        "q+" : Math.floor((this.getMonth()+3)/3), //季度 
	        "S"  : this.getMilliseconds()             //毫秒 
	    }; 
	    if(/(y+)/.test(fmt)) {
	    	fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
	    }
	    for(var k in o) {
	    	if(new RegExp("("+ k +")").test(fmt)){
	             fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
	         }
	     }
	    return fmt; 
		};
		
		 //渲染部门格式
        function formatDepartment(l1Name,l2Name,l3Name,l4Name){
        	var array =[l1Name,l2Name,l3Name,l4Name];
        	var tag="/";//标识符
        	var result="";//返回部门格式
        	var orgArray=[];//存部门数据
        	
        	for(var i=0; i<array.length;i++){
        		if(null!=array[i]){
        			orgArray[i]=array[i];
        		}
        	}
        	
        	for(var i=0;i<orgArray.length;i++){
        		if(null!=orgArray[i]){
	        		if(i!=orgArray.length-1){
	    				result+=orgArray[i]+tag;
	    			}else{
	    				result+=orgArray[i];
	    			}
        		}
        	}
        		return result;
        }
        
     //返回时间格式   date 时间戳格式值 如 2018-05-07 09:19:52.0
        function getDateTime(date){
        	 var curTime;
		      if(date == null || date == ""){
		        	curTime = "";
		      }else{
			        var oldTime = (new Date(''+date+'')).getTime();
					curTime = new Date(oldTime).format("yyyy-MM-dd hh:mm:ss");
			  }
		      
		      return curTime;
        	
        }
        //返回日期格式  date 时间戳格式值 如 2018-05-07 09:19:52.0
        function getDate(date){
       	 var curTime;
		      if(date == null || date == ""){
		        	curTime = "";
		      }else{
			        var oldTime = (new Date(''+date+'')).getTime();
					curTime = new Date(oldTime).format("yyyy-MM-dd");
			  }
		      
		      return curTime;
       	
       }
        //返回时间格式   date 时间戳格式值 如 2018-05-07 09:19(年月日时分)
        function getDateMinute(date){
        	 var curTime;
		      if(date == null || date == ""){
		        	curTime = "";
		      }else{
			        var oldTime = (new Date(''+date+'')).getTime();
					curTime = new Date(oldTime).format("yyyy-MM-dd hh:mm");
			  }
		      
		      return curTime;
        	
        } 
        
        //时间字符串加一天
	    function dateAddDays(dataStr,dayCount) {  
		    var strdate=dataStr; //日期字符串  
		    if(strdate == "" || strdate == null){
		    	return;
		    }
		    var isdate = new Date(strdate.replace(/-/g,"/"));  //把日期字符串转换成日期格式  
		    isdate = new Date((isdate/1000+(86400*dayCount))*1000);  //日期加1天  
		    var Month=(isdate.getMonth()+1);
		    if(Month < 10){
		    	Month = "0"+Month;
		    }
		    var Day =(isdate.getDate());
		    if(Day < 10){
		    	Day = "0"+Day;
		    }
		    var pdate = isdate.getFullYear()+"-"+Month+"-"+Day;   //把日期格式转换成字符串  
		    return pdate;
		    
		}  
        
        //鼠标悬浮显示过长的字
		 function selbox(a){
			var val = a.val();
			a.attr("title",val);
		}
		 
		 
		 //报表的重置方法
	    function resetRecr(){
	    	document.getElementById("form1").reset();
	    	$("#recruiter_name").attr("data","");
	    	
	    }
		 
		 /**
		  * 选择招聘负责人
		  * oneself:本身
		  * data:赋值招聘负责人ID
		  */
		 function getRecruiterName(oneself){
			 		current =oneself;//点击招聘负责人（自身）
			   		layui.use('layer', function(){	
		 				 var layer = layui.layer;
						  	 layer.open({
							    area: ['770px', '510px'],
								type: 2,
								shade: 0.8,
								closeBtn: false,
								title:'选择招聘负责人',
								closeBtn: false,//不显示关闭图标
							    btn: ['选择', '关闭'],
								content: [server_context+'task/takeEmp_select.jsp','no'], //这里content是一个URL
			                    yes: function(index,lay){
									var iframeWin = window[lay.find('iframe')[0]['name']];//得到iframe页的窗口对象，执行iframe页的方法：
					                var ids = iframeWin.backPrice();//调用子页面的方法，得到子页面返回的ids 
					               	var json = $.parseJSON(ids);
			                    		$(oneself).val(json.name);
			                    		$(oneself).attr("data",json.id);
			                    		layer.close(index);
		       					}
							}); 
					}); 
	    }
		 
		var myDate = new Date();
		var dateString =  myDate.toLocaleDateString();
		
		function init_laydate(){
			// 日期
		    layui.use('laydate', function(){
			  	var laydate = layui.laydate;
			  	$("#audit_time,#offer_time,#atual_hire_date").each(function(index,element){
			  		// 执行一个laydate实例
			  		var id = element.id;
				  	laydate.render({
				    	elem: '#'+id //指定元素
				    	,range:'~'
				    	,min: '2017-03-01'
	  					,max: dateString
				  	});
			  	});
			});
		}
		
		
		var Diction;
		$(function() {
		//查询字典
		getDiction();
		function getDiction(){
			
			$.ajax({
  			url:"com.recruit.talent.talentpoolselect.selectDiction.biz.ext",
  			type:"POST",
  			data:{
  			},
  			success:function(data){
  				
  				Diction=data;
  			}
  			});
		}
		});
		//翻译渠道
		function getChannels(id){
			var channels="";
			for(var k = 0; k < Diction.rerecruitchannel.length; k++){
			if(Diction.rerecruitchannel[k].dictID==id){
					channels = Diction.rerecruitchannel[k].dictName;
					}
			}
			return channels;
			
		
		}
		//翻译供应商
		function getSuppliers(id){
			var Suppliers="";
			for(var k = 0; k < Diction.rerecruitprovider.length; k++){
			if(Diction.rerecruitprovider[k].dictID==id){
					Suppliers = Diction.rerecruitprovider[k].dictName;
					}
			}
			return Suppliers;
			
		
		}
		
		//校招发布职位类别
		function position(id){
			var position="";
			for(var k = 0; k < Diction.positionType.length; k++){
			if(Diction.positionType[k].dictID==id){
				position = Diction.positionType[k].dictName;
					}
			}
			return position;
			
		
		}
		//翻译期待薪酬
		function getReexpected(id){
			var Reexpected="";
			for(var k = 0; k < Diction.reexpected.length; k++){
			if(Diction.reexpected[k].dictID==id){
				Reexpected = Diction.reexpected[k].dictName;
					}
			}
			return Reexpected;
			
		
		}
		
		 //当路径为参数，对路径转义
        function topath(path){
        	var returnpath = "\""+path+"\"";
        	return returnpath;
        }
        
      //截取简历地址
		function getCaption(obj){
		    var index=obj.lastIndexOf("resume/");
		    obj=obj.substring(index,obj.length);
		    return obj;
	    }
		
		//计算开始时间，结束时间总时长（分钟）
		function dateCount(startDate,endDate){
			 //var startDate="2018-12-02 12:25";
			 //var endDate="2018-12-02 12:35";
			 //定义两个变量startDate,endDate分别保存开始和结束时间
			 //返回时间格式   date 时间戳格式值 如 2018-05-07 09:19:52.0
			
			if(typeof(startDate)!="undefined"&&typeof(endDate)!="undefined"&&startDate!=null&&endDate!=null&&startDate!=""&&endDate!=""){
				startDate =getDateTime(startDate);
				endDate =getDateTime(endDate);
			  //截取字符串，得到日期部分"2009-12-02",用split把字符串分隔成数组
			  var begin=startDate.substr(0,10).split("-");
			  var end=endDate.substr(0,10).split("-");
			 
			  //将拆分的数组重新组合，并实例成化新的日期对象
			  var startdate=new Date(begin[1] + - + begin[2] + - + begin[0]);
			  var enddate=new Date(end[1] + - + end[2] + - + end[0]);
			 
			  //得到两个日期之间的差值m，以分钟为单位
			  var m=parseInt(Math.abs(enddate-startdate)/1000/60);
			 
			  //小时数和分钟数相加得到总的分钟数
			  var minCount=parseInt(startDate.substr(11,2))*60+parseInt(startDate.substr(14,2));
			  var minNum=parseInt(endDate.substr(11,2))*60+parseInt(endDate.substr(14,2));
			 
			  //两个分钟数相减得到时间部分的差值，以分钟为单位
			  var n=minNum-minCount;
			 
			  //将日期和时间两个部分计算出来的差值相加，即得到两个时间相减后的分钟数
			  return minutes=m+n;
			}else{
				return 0;
			}
		}
		
		function returnEvent(){
			//回车键触发点击事件
			$("body").keydown(function() {
				var event=arguments.callee.caller.arguments[0]||window.event;//消除浏览器差异
	             if (event.keyCode == "13") {//keyCode=13是回车键
	                 $('.returnEvent_select').click();
	             }
	         });
		
		}
